﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using MetroUI.Forms;

namespace eService.Presentation
{
    public partial class frmCaiDatHeThong : MetroForm
    {
        //Mac Dinh frmCauHinh_DuLieu
        EnumNameForm.FormHeThong NameForm = EnumNameForm.FormHeThong.HienThi;
        //Khoi Tao usrc
        usrcCauHinh_DuLieu dulieu;
        usrcCauHinh_HienThi hienthi;
        usrcCauHinh_HoaDon hoadon;
        usrcCauHinh_Gia_PhuThuKhac gia;
        usrcThongTinCongTy congty;

        public frmCaiDatHeThong(EnumNameForm.FormHeThong _NameForm)
        {
            InitializeComponent();
            NameForm = _NameForm;
            LoadUI();
            ChonUI(NameForm);
        }
        public frmCaiDatHeThong()
        {
            InitializeComponent();
            LoadUI();
            ChonUI(EnumNameForm.FormHeThong.HienThi);
        }
        private void LoadUI()
        {
            Screen scr = Screen.PrimaryScreen;
            //Phan Quyen O Day!

            //--------Du Lieu-----------------
            dulieu = new usrcCauHinh_DuLieu();
            this.Controls.Add(dulieu);
            dulieu.Size = new Size(this.Width - pnlLine.Location.X-60, this.Height);
            dulieu.Location = new Point(pnlLine.Location.X, 5);
            //dulieu.Visible = false;

            //--------Hien Thi-----------------
            hienthi = new usrcCauHinh_HienThi();
            this.Controls.Add(hienthi);
            hienthi.Size = new Size(this.Width - pnlLine.Location.X-60, this.Height);
            hienthi.Location = new Point(pnlLine.Location.X, 5);
            //hienthi.Visible = false;

            //--------Hoa Don-----------------
            hoadon = new usrcCauHinh_HoaDon();
            this.Controls.Add(hoadon);
            hoadon.Size = new Size(this.Width - pnlLine.Location.X-60, this.Height);
            hoadon.Location = new Point(pnlLine.Location.X, 5);
            //hoadon.Visible = false;

            //--------Gia-----------------
            gia = new usrcCauHinh_Gia_PhuThuKhac();
            this.Controls.Add(gia);
            gia.Size = new Size(this.Width - pnlLine.Location.X-60, this.Height);
            gia.Location = new Point(pnlLine.Location.X, 5);
            //gia.Visible = false;

            //--------Cong ty-----------------
            congty = new usrcThongTinCongTy();
            this.Controls.Add(congty);
            congty.Size = new Size(this.Width - pnlLine.Location.X - 60, this.Height);
            congty.Location = new Point(pnlLine.Location.X, 5);
        }
        private void ChonUI(EnumNameForm.FormHeThong _NameForm)
        {
            dulieu.Visible = false;
            hienthi.Visible = false;
            hoadon.Visible = false;
            gia.Visible = false;
            congty.Visible = false;
            switch (_NameForm)
            {
                case EnumNameForm.FormHeThong.HienThi:
                    hienthi.Visible = true;
                    btnHienThi.Checked = true;
                    break;
                case EnumNameForm.FormHeThong.HoaDon:
                    hoadon.Visible = true;
                    btnHoaDon.Checked = true;
                    break;
                case EnumNameForm.FormHeThong.Gia:
                    gia.Visible = true;
                    btnGiaPhuThu.Checked = true;
                    break;
                case EnumNameForm.FormHeThong.CongTy:
                    congty.Visible = true;
                    btnCongTy.Checked = true;
                    break;
            }
        }
        private void button_Click(object sender, EventArgs e)
        {
            KryptonCheckButton btn = (KryptonCheckButton)sender;
            string nameform = btn.Tag.ToString();
            switch (nameform)
            {
                case "HienThi":
                    ChonUI(EnumNameForm.FormHeThong.HienThi);
                    break;
                case "HoaDon":
                    ChonUI(EnumNameForm.FormHeThong.HoaDon);
                    break;
                case "Gia":
                    ChonUI(EnumNameForm.FormHeThong.Gia);
                    break;
                case "CongTy":
                    ChonUI(EnumNameForm.FormHeThong.CongTy);
                    break;
            }

        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
